/// <summary>
/// 近战攻击状态
/// </summary>
public class MeleeAttackState : IState
{
    public MeleeAttackState(FSM manager)
    {
        this.manager = manager;
        this.parameter = manager.parameter;
    }

    public override  void OnEnter()
    {
        AudioManager.Instance.PlaySFX("挥剑");
        parameter.animator.SetTrigger("MeleeAttack");
    }
    public override  void OnUpdate()
    {
        //受伤
        if (parameter.isHurt)
        {
            manager.TransitionState(StateType.Hit);
        }

        // 动画播放95%切换到待机状态
        if (parameter.animatorStateInfo.normalizedTime >= .95f)
        {
            manager.TransitionState(StateType.Idle);
        }
    }
    public override  void OnFixedUpdate()
    {
        manager.Move();
    }
    public override  void OnExit()
    {
        parameter.isMeleeAttack = false;
    }
}
